gsk: Make profiler counters more useful
authorMatthias Clasen <mclasen@redhat.com>
Mon, 25 Sep 2017 21:03:06 +0000 (17:03 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 25 Sep 2017 21:03:06 +0000 (17:03 -0400)
Make it possible to have counters that get incremented
by values other than 1.

gsk/gskprofiler.c
gsk/gskprofilerprivate.h

index f3b2bd53f66fc73b2b18e002dcf3a8d004d82542..bc7301046b353139dbdbaae00a3d1af5b6723bfd 100644 (file)
@@ -202,6 +202,14 @@ gsk_profiler_add_timer (GskProfiler *profiler,
 void
 gsk_profiler_counter_inc (GskProfiler *profiler,
                           GQuark       counter_id)
+{
+  gsk_profiler_counter_add (profiler, counter_id, 1);
+}
+
+void
+gsk_profiler_counter_add (GskProfiler *profiler,
+                          GQuark       counter_id,
+                          gint64       increment)
 {
   NamedCounter *counter;
 
@@ -211,8 +219,7 @@ gsk_profiler_counter_inc (GskProfiler *profiler,
   if (counter == NULL)
     return;
 
-  counter->value += 1;
-
+  counter->value += increment;
 }
 
 void
index 382ecc895bdb89570b6f6f007cd272ec58df12ab..e30a810432d9d3d6b7cafbf71313d6339bebae7d 100644 (file)
@@ -22,6 +22,9 @@ GQuark          gsk_profiler_add_timer          (GskProfiler *profiler,
 
 void            gsk_profiler_counter_inc        (GskProfiler *profiler,
                                                  GQuark       counter_id);
+void            gsk_profiler_counter_add        (GskProfiler *profiler,
+                                                 GQuark       counter_id,
+                                                 gint64       increment);
 void            gsk_profiler_timer_begin        (GskProfiler *profiler,
                                                  GQuark       timer_id);
 gint64          gsk_profiler_timer_end          (GskProfiler *profiler,